home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
et
/
et3_0-a1.lha
/
et3
/
src
/
MemBuf.C
< prev
next >
Wrap
C/C++ Source or Header
|
1992-06-25
|
514b
|
34 lines
#ifdef __GNUG__
#pragma implementation
#endif
#include "MemBuf.h"
#include "Storage.h"
MemBuf::MemBuf(int size, char *p, int count, bool alloc) : StreamBuf(size, p, count, alloc)
{
}
int MemBuf::overflow(int c)
{
if (c != EOF) {
size_t pos= (size_t) (ptr-base);
setbuf((char*)Realloc(base, pos*2), pos*2, 0, FALSE);
ptr= base+pos;
*ptr++= c;
}
return zapeof(c);
}
void MemBuf::SwitchToRead()
{
gptr= ptr;
ptr= base;
fpos= 0;
}
long MemBuf::ContentsSize()
{
return gptr-base;
}